Skip to content

feat: preserve the signed envelope in the action log when a send fails - #2697

Open
Galmanus wants to merge 1 commit into
stellar:mainfrom
Galmanus:feat/2609-preserve-failed-send
Open

feat: preserve the signed envelope in the action log when a send fails#2697
Galmanus wants to merge 1 commit into
stellar:mainfrom
Galmanus:feat/2609-preserve-failed-send

Conversation

@Galmanus

Copy link
Copy Markdown

What

When send_transaction_polling fails, both send paths (tx.rs::send and tx/args.rs::handle_tx) now save the signed envelope to the action log as a new Action::SendFailed { envelope_xdr } entry and print the exact pipeline to resubmit without re-signing:

stellar cache actionlog read --id <ULID> | jq -r .action.send_failed.envelope_xdr | stellar tx send

Why

Fixes #2609, following the direction in the issue discussion of extending the existing action-log machinery rather than adding a retry command. Previously the action-log write only ran after a successful submit, so a network hiccup after interactive signing (hardware wallet, multisig) lost the envelope and every signature had to be collected again.

Notes for review:

  • The envelope is written through the existing data::write path — hardened file permissions, RPC URL redacted — the same guarantees the current action log provides.
  • Saving is best-effort: a cache-write failure is logged at debug level and never masks the original RPC error, and --no-cache skips it entirely.
  • The action log is flagged Experimental, so the new externally-tagged variant is a compatible addition; old entries still deserialize.

Testing

  • New unit test test_send_failed_round_trips_and_renders_as_failed: the variant round-trips through write/read unchanged and actionlog ls renders a distinct SendFail/FAILED row. Uses the existing STELLAR_DATA_HOME + #[serial] harness.
  • cargo test -p soroban-cli --lib config::data::: 4 passed. cargo clippy and cargo fmt --check clean.

A failed `send_transaction_polling` returned early and lost the signed
(and possibly fee-bumped) envelope: the action-log write only ran after a
successful submit. For anything signed interactively — hardware wallet,
multisig — that means collecting every signature again just to retry.

On a send failure, both send paths now save the envelope as a new
`Action::SendFailed { envelope_xdr }` action-log entry (reusing the
existing hardened-file write with the RPC URL redacted) and print the
exact pipeline to resubmit it without re-signing via `stellar tx send`.
Saving is best-effort: a cache-write failure is logged at debug level and
never masks the original RPC error.

Fixes stellar#2609
Copilot AI balanced review requested due to automatic review settings August 22, 2026 10:48
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Aug 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Preserves signed transaction envelopes after failed submissions so users can retry without re-signing.

Changes:

  • Adds best-effort failed-envelope caching and recovery guidance.
  • Introduces SendFailed action-log entries with distinct rendering.
  • Adds serialization and display coverage for the new action type.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
cmd/soroban-cli/src/tx.rs Saves failed signed envelopes and prints retry instructions.
cmd/soroban-cli/src/config/data.rs Adds and tests the SendFailed action type.
cmd/soroban-cli/src/commands/tx/args.rs Preserves envelopes for failed transaction-operation sends.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/soroban-cli/src/tx.rs
Ok(id) => print.warnln(format!(
"The transaction failed to send, but the signed envelope was saved to the \
action log and can be resubmitted without re-signing:\n \
stellar cache actionlog read --id {id} | jq -r .action.send_failed.envelope_xdr | stellar tx send"

#[test]
#[serial]
fn test_send_failed_round_trips_and_renders_as_failed() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

Graceful tx fail with retry

2 participants